package com.william.jdbcplus.test.config;

import com.william.jdbcplus.test.util.PropertiesUtil;

public class ConfigUtil {

    //配置路径
    private final static String CONF_PATH = "/config.properties";

    /**
     * 数据库连接字符串
     */
    public static String mysql_url;

    /**
     * 用户名
     */
    public static String mysql_username;

    /**
     * 密码
     */
    public static String mysql_password;

    /**
     * 数据库连接字符串
     */
    public static String oracle_url;

    /**
     * 用户名
     */
    public static String oracle_username;

    /**
     * 密码
     */
    public static String oracle_password;

    /**
     * 数据库连接字符串
     */
    public static String sqlserver_url;

    /**
     * 用户名
     */
    public static String sqlserver_username;

    /**
     * 密码
     */
    public static String sqlserver_password;

    /**
     * redis主机
     */
    public static String redis_host;

    /**
     * redis端口
     */
    public static Integer redis_port;

    /**
     * redis密码
     */
    public static String redis_password;

    static {
        mysql_url = PropertiesUtil.getPropertiesKey(CONF_PATH, "mysql.url");
        mysql_username = PropertiesUtil.getPropertiesKey(CONF_PATH, "mysql.username");
        mysql_password = PropertiesUtil.getPropertiesKey(CONF_PATH, "mysql.password");

        oracle_url = PropertiesUtil.getPropertiesKey(CONF_PATH, "oracle.url");
        oracle_username = PropertiesUtil.getPropertiesKey(CONF_PATH, "oracle.username");
        oracle_password = PropertiesUtil.getPropertiesKey(CONF_PATH, "oracle.password");

        sqlserver_url = PropertiesUtil.getPropertiesKey(CONF_PATH, "sqlserver.url");
        sqlserver_username = PropertiesUtil.getPropertiesKey(CONF_PATH, "sqlserver.username");
        sqlserver_password = PropertiesUtil.getPropertiesKey(CONF_PATH, "sqlserver.password");

        redis_host = PropertiesUtil.getPropertiesKey(CONF_PATH, "redis.host");
        redis_port = Integer.parseInt(PropertiesUtil.getPropertiesKey(CONF_PATH, "redis.port"));
        redis_password = PropertiesUtil.getPropertiesKey(CONF_PATH, "redis.password");
    }
}
